import React, { Component } from 'react';
import { Button, Grid, Card } from '@teamix/ui';
import PropTypes from 'prop-types';
import intl from '../../../../../../../locale';

export default class NotExist extends Component {
  static propTypes = {
    fullName: PropTypes.string,
    removeProject: PropTypes.func,
  };

  static defaultProps = {
    fullName: null,
    removeProject: null,
  };

  render() {
    const { fullName, removeProject } = this.props;

    return (
      <Grid.Row>
        <Grid.Col span="6" />

        <Grid.Col span="10">
          <Card
            title={intl.get({
              id: 'code-assets.src.utils.locale.CodeBaseDoesNotExist',
              defaultMessage: '代码库不存在',
            })}
            className="not-exist-card"
          >
            <div className="not-exist-card-content">
              <span value="repository_not_exist_tips">
                {intl.get({
                  id: 'code-assets.projectFiles.containers.notExist.CodeBase',
                  defaultMessage: '代码库',
                })}

                <strong className="strong-red">{fullName}</strong>
                {intl.get({
                  id: 'code-assets.projectFiles.containers.notExist.NotCreatedAfterRegistration',
                  defaultMessage: '注册后并未创建。',
                })}
              </span>
              <Button type="primary" warning onClick={removeProject}>
                {intl.get({
                  id: 'code-assets.src.utils.locale.Delete',
                  defaultMessage: '删除',
                })}
              </Button>
            </div>
          </Card>
        </Grid.Col>
        <Grid.Col span="6" />
      </Grid.Row>
    );
  }
}
